package com.typhoon.spring_jdbctemplate.listener;

import com.typhoon.spring_jdbctemplate.entity.User;

import java.lang.ref.WeakReference;

public class TestMain {
	public static void main(String[] args) throws Exception {
		User u = new User();
		WeakReference<User> studentWeakRef = new WeakReference<>(u);
		u = null;
		System.out.println(studentWeakRef.get());

		System.gc();
		System.out.println("After Gc:");
		System.out.println(studentWeakRef.get());//gc之后一定会被回收
	}


}
